const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');

module.exports = {
  devtool: 'source-map',
  module:{
    rules:[{
      test:/\.(js|tsx|jsx)$/,
      exclude:[/node_modules/],
      use:{
        loader:'babel-loader',
        options:{
          cacheDirectory: true,
        }
      }
    },{
      test: /\.css$/,
      use: ['style-loader', 'css-loader']
    },{
      test: /\.(png|svg|jp?g|gif)$/i,
      loader: 'file-loader',
      options:{
        outputPath: 'images',
        esModule: false
      }
    },{
      test: /\.(woff|woff2|eot|ttf|otf)$/,
      use: ['file-loader']
    }]
  },
  plugins:[
    new CleanWebpackPlugin({verbose: true}),
    new ManifestPlugin(),  //生成映射关系文件
  ]
};